Skip to content

typescript-rxjs: fix query parameters type#4160

Merged
macjohnny merged 3 commits into
OpenAPITools:masterfrom
macjohnny:bugfix/4159-typescript-rxjs-query-parameters-type
Oct 16, 2019
Merged

typescript-rxjs: fix query parameters type#4160
macjohnny merged 3 commits into
OpenAPITools:masterfrom
macjohnny:bugfix/4159-typescript-rxjs-query-parameters-type

Conversation

@macjohnny

Copy link
Copy Markdown
Member

fixes #4159

cc @akehir @denyo

@macjohnny macjohnny changed the title Bugfix/4159 typescript rxjs query parameters type typescript-rxjs: fix query parameters type Oct 15, 2019
@macjohnny macjohnny added this to the 4.2.0 milestone Oct 15, 2019
@macjohnny macjohnny merged commit f195f8f into OpenAPITools:master Oct 16, 2019
@denyo

denyo commented Oct 16, 2019

Copy link
Copy Markdown
Contributor

I would have preferred the as operator like as HttpQuery.

@denyo

denyo commented Oct 16, 2019

Copy link
Copy Markdown
Contributor

Or even cleaner would be extending the definition of HttpQuery:

type HttpQuery = { [key: string]: string | number | null | boolean | Array<string | number | null | boolean> } | {};

Then the generated controllers would not be affected at all.

@macjohnny

Copy link
Copy Markdown
Member Author

@denyo will you file a PR to make the changeS?

@denyo

denyo commented Oct 16, 2019

Copy link
Copy Markdown
Contributor

I can't before next week.

@akehir

akehir commented Oct 16, 2019

Copy link
Copy Markdown
Contributor

The problem is this:

type HttpQuery = ... | {};

If HttpQuery is defined as such, it should work:

type HttpQuery = Partial<{ [key: string]: string | number | null | boolean | Array<string | number | null | boolean> }>;

See a working example: TS Playground

@wing328

wing328 commented Oct 31, 2019

Copy link
Copy Markdown
Member

@macjohnny thanks for the PR, which has been included in v4.2.0 release: https://twitter.com/oas_generator/status/1189824932345069569

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] [typescript-rxjs] Typescript error in generated files for query parameters

4 participants